<?php /*a:5:{s:54:"D:\phpstudy_pro\WWW\tp\app\admin\view\index\index.html";i:1640261441;s:49:"D:\phpstudy_pro\WWW\tp\app\admin\view\layout.html";i:1640261441;s:54:"D:\phpstudy_pro\WWW\tp\app\admin\view\common\meta.html";i:1655800829;s:56:"D:\phpstudy_pro\WWW\tp\app\admin\view\common\header.html";i:1640261441;s:56:"D:\phpstudy_pro\WWW\tp\app\admin\view\common\footer.html";i:1640261441;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

<script src="/static/layui/layui.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="/static/layui/js-3.1.1.min.js"></script>
    <title>VeeCMF 通用后台管理系统 - 快速接口开发 快速后台开发</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css">
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
    <div class="layui-logo layui-hide-xs layui-bg-black">VeeCMF</div>
    <!-- 头部区域（可配合layui 已有的水平导航） -->
    <ul class="layui-nav layui-layout-left">
        <!-- 移动端显示 -->
        <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
            <i class="layui-icon layui-icon-spread-left"></i>
        </li>
        <?php foreach($layout_menu_list as $key=>$vo): if($vo['position'] == '1'): if($vo['show'] == '1'): if($vo['status'] == '1'): if(is_array($promise_menu_id) == true): foreach($promise_menu_id as $idx=>$menu_id): if($menu_id == $vo['id']): ?>
                        <li class="layui-nav-item layui-hide-xs"><a href="<?php echo htmlentities($vo['route']); ?>"><?php echo htmlentities($vo['title']); ?></a></li>
                    <?php endif; ?>
                <?php endforeach; else: ?>
                    <li class="layui-nav-item layui-hide-xs"><a href="<?php echo htmlentities($vo['route']); ?>"><?php echo htmlentities($vo['title']); ?></a></li>
                <?php endif; ?>
            <?php endif; ?>
            <?php endif; ?>
            <?php endif; ?>
        <?php endforeach; ?>
<!--        <li class="layui-nav-item">-->
<!--            <a href="javascript:;">工具</a>-->
<!--            <dl class="layui-nav-child">-->
<!--                <dd><a href="">尚未开发</a></dd>-->
<!--            </dl>-->
<!--        </li>-->
    </ul>
    <ul class="layui-nav layui-layout-right">
        <li class="layui-nav-item layui-hide layui-show-md-inline-block">
            <a href="javascript:;">
                <img src="<?php echo htmlentities($rootData['avatar_src']); ?>" class="layui-nav-img">
                <?php echo htmlentities($rootData['root_name']); ?>
            </a>
            <dl class="layui-nav-child">
<!--                <dd><a href="">个人资料</a></dd>-->
<!--                <dd><a href="">个人设置</a></dd>-->
                <dd><a href="/admin/login/logout">退出登录</a></dd>
            </dl>
        </li>
        <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
            <a href="javascript:;">
                <i class="layui-icon layui-icon-more-vertical"></i>
            </a>
        </li>
    </ul>
</div>


<div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
        <ul class="layui-nav layui-nav-tree" lay-filter="test" id="menu">

        </ul>
    </div>
</div>
<script>
    var res = <?php echo $layout_menu_list_json; ?>

    $("#menu").html('')
    layui.use('element', function () {
        element = layui.element;
        //console.log(res)
        let header = '';
        res.forEach( v => {
            header += `
                            <li class="layui-nav-item" id="header_${v.id}"><a href="javascript:;">${v.title}</a></li>
                        `
            var content = '<li class="layui-nav-item">';
            if(v.position == 0 && v.status == 1 && v.show == 1){
                content += '<a href="javascript:;">' + v.title + '</a>';
                content += loadchild(v);
                content += '</li>';
            }
            //这里是添加所有的子菜单
            $("#menu").append(content);
        })
        $('#layuiHeader').html(header)

        element.init();

        // 表头点击事件
        $("#layuiHeader").on("click", 'li', function() {
            // 表头添加样式
            $.each($(this).siblings(), function (i, e) {
                $(e).find("a").removeClass('layui-this')
            });
            $(this).find("a").addClass('layui-this');

            // 侧边栏
            let id = $(this).attr("id").split('_')[1];
            //console.log(id)
            let newArr = res.filter( v => {
                return v.id == id
            })
            // console.log(newArr[0])

            $("#menu").html('');

            newArr.forEach( v => {
                var content = '<li class="layui-nav-item">';
                if(v.position == 0 && v.status == 1 && v.show == 1) {
                    content += '<a href="javascript:;">' + v.title + '</a>';
                    //这里是添加所有的子菜单
                    content += loadchild(v);
                    content += '</li>';
                }
                $("#menu").append(content);
            })
            element.init();

        })
    });


    //组装子菜单的方法
    function loadchild(obj) {
        if (obj == null) {
            return;
        }
        var content = '';
        if (obj.child != null && obj.child.length > 0) {
            content += '<dl class="layui-nav-child">';
        } else {
            content += '<dl>';
        }

        if (obj.child != null && obj.child.length > 0) {
            $.each(obj.child, function (i, note) {
                if(note.position == 0 && note.status == 1 && note.show == 1) {
                    content += '<dd>';
                    content += '<a href="' + note.route + '" onclick="viewClick(' + note.parent_id + ')">' + note.title + '</a>';
                    if (note.child == null) {
                        return;
                    }
                    content += loadchild(note);
                    content += '</dd>';
                }
            });

            content += '</dl>';
        }
        //console.log(content);
        return content;
    }

    // 侧边栏点击事件
    function viewClick(parent_res_id) {
        //console.log(parent_res_id);
        $('#header_' + parent_res_id)
        $.each($('#header' + parent_res_id).siblings(), function (i, e) {
            $(e).find("a").removeClass('layui-this')
        });
        $('#header_' + parent_res_id).find("a").addClass('layui-this');
    }
</script>

    <div class="layui-body">
        <div class="layui-bg-gray" style="padding: 5px;">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-panel">
                        <div style="padding: 0.5rem 1rem;">
                            <span class="layui-breadcrumb" lay-separator="—">
                            <?php foreach($menuAllParent as $key=>$vo): if($vo['isChild'] == '1'): ?>
                                    <a><cite><?php echo htmlentities($vo['title']); ?></cite></a>
                                <?php else: ?>
                                    <a href="<?php echo htmlentities($vo['route']); ?>"><?php echo htmlentities($vo['title']); ?></a>
                                <?php endif; ?>
                            <?php endforeach; ?>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-bg-gray" style="padding: 5px;">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-panel">
                        <div style="padding: 0.5rem 1rem;">
                            <div style="padding: 15px;">
<!--引入Echart-->
<script src="https://cdn.jsdelivr.net/npm/echarts@5.1.1/dist/echarts.min.js"></script>

<div class="layui-bg-gray">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md6">
            <div class="layui-card">
                <div class="layui-card-header">Echarts使用Demo(静态数据)</div>
                <div class="layui-card-body">
                    <!-- 为 ECharts 准备一个定义了宽高的 DOM -->
                    <div id="main" style="width:100%;height:280px;"></div>
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-card">
                <div class="layui-card-header">Echarts使用Demo(动态数据)</div>
                <div class="layui-card-body">
                    <!-- 为 ECharts 准备一个定义了宽高的 DOM -->
                    <div id="main2" style="width:100%;height:280px;"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="layui-bg-gray">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md6">
            <div class="layui-card">
                <div class="layui-card-header">Echarts使用Demo(静态数据)</div>
                <div class="layui-card-body">
                    <!-- 为 ECharts 准备一个定义了宽高的 DOM -->
                    <div id="main3" style="width:100%;height:280px;"></div>
                </div>
            </div>
        </div>
    </div>
</div>


<!--Echart脚本-->
<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));

    // 指定图表的配置项和数据
    var option = {
        title: {
            left: 'center'
        },
        tooltip: {
            trigger: 'item'
        },
        legend: {
            bottom: 10,
        },
        series: [
            {
                name: '访问来源',
                type: 'pie',
                radius: '50%',
                data: [
                    {value: 1048, name: '总销售额'},
                    {value: 735, name: '退款金额'},
                    {value: 580, name: '未消费'},
                    {value: 484, name: '未提现'},
                    {value: 300, name: '已提现'}
                ],
                emphasis: {
                    itemStyle: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
</script>

<script>
    var myChart2 = echarts.init(document.getElementById('main2'));
    option = {
        title: {
            text: '本周后台请求'
        },
        tooltip: {
            trigger: 'axis'
        },
        legend: {},
        toolbox: {
            show: true,
            feature: {
                dataZoom: {
                    yAxisIndex: 'none'
                },
                dataView: { readOnly: false },
                magicType: { type: ['line', 'bar'] },
                restore: {},
                saveAsImage: {}
            }
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: <?php echo $adminLogDate; ?>
        },
        yAxis: {
            type: 'value',
            axisLabel: {
                formatter: '{value}次'
            }
        },
        series: [
            {
                name: '最高',
                type: 'line',
                data: <?php echo $adminLogCount; ?>,
                markPoint: {
                    data: [
                        { type: 'max', name: '最高点' },
                        { type: 'min', name: '最低点' }
                    ]
                },
                markLine: {
                    data: [{ type: 'average', name: 'Avg' }]
                }
            }
        ]
    };
    myChart2.setOption(option);
</script>

<script>
    var myChart3 = echarts.init(document.getElementById('main3'));
    option = {
        title: {
            text: '本周接口请求'
        },
        tooltip: {
            trigger: 'axis'
        },
        legend: {},
        toolbox: {
            show: true,
            feature: {
                dataZoom: {
                    yAxisIndex: 'none'
                },
                dataView: { readOnly: false },
                magicType: { type: ['line', 'bar'] },
                restore: {},
                saveAsImage: {}
            }
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: <?php echo $apiLogDate; ?>
        },
        yAxis: {
            type: 'value',
            axisLabel: {
                formatter: '{value}次'
            }
        },
        series: [
            {
                name: '最高',
                type: 'line',
                data: <?php echo $apiLogCount; ?>,
            markPoint: {
        data: [
            { type: 'max', name: '最高点' },
            { type: 'min', name: '最低点' }
        ]
    },
    markLine: {
        data: [{ type: 'average', name: 'Avg' }]
    }
    }
    ]
    };
    myChart3.setOption(option);
</script>
</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--<div class="layui-footer">-->
<!--    &lt;!&ndash; 底部固定区域 &ndash;&gt;-->
<!--    底部固定区域-->
<!--</div>-->

<script>
    //JS
    layui.use(['element', 'layer', 'util'], function(){
        var element = layui.element
            ,layer = layui.layer
            ,util = layui.util
            ,$ = layui.$;

        //头部事件
        util.event('lay-header-event', {
            //左侧菜单事件
            menuLeft: function(othis){
                layer.msg('展开左侧菜单的操作', {icon: 0});
            }
            ,menuRight: function(){

                layer.open({
                    type: 1
                    ,content: '<div id="msgList"></div>'
                    ,area: ['260px', '100%']
                    ,offset: 'rt' //右上角
                    ,anim: 5
                    ,shadeClose: true
                });
                var html = '';
                $.ajax({
                    url: "http://1.117.149.125:81/api/msgList",
                    type: "GET",
                    data:{
                        'data':'',
                    },
                    dataType: "json",
                    success: function(data){
                        data['data'].forEach(function(item) {
                            console.log(item);
                            html += '<div style="padding: 15px;">'+item['content']+'</div>';
                        });
                        $('#msgList').html(html);
                    },
                    error:function(err){
                        console.log(err.statusText);
                    }
                });
            }
        });

    });
</script>
</div>

</body>
</html>